﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace LinkUp
{
    /// <summary>
    /// 网格块类
    /// </summary>
    public class Block
    {
        /// <summary>
        /// 创建网格块，需要输入键值。
        /// </summary>
        public Block(int key)
        {
            bValue = key;
            //默认值
            bWidth = 60;
            bHeight = 40;
        }
        #region user functions
        /// <summary>
        /// 处理图片，创建网格块
        /// </summary>
        public void Create()
        {
            if (image == null)
            {
                string dir = "Images\\Classic\\";
                image = new Bitmap(new Bitmap(dir + bValue.ToString() + ".bmp"), bWidth, bHeight);
            }
            else
            {
                //图片放缩
                image = new Bitmap(image, bWidth, bHeight);
            }
        }

        #endregion
        #region field and property
        private Bitmap image;
        /// <summary>
        /// 网格块的表面图片
        /// </summary>
        public Bitmap Image
        {
            get { return image; }
            set { image = value; }
        }
        private int bWidth;
        /// <summary>
        /// 网格块的宽度
        /// </summary>
        public int BWidth
        {
            get { return bWidth; }
            set { bWidth = value; }
        }
        private int bHeight;
        /// <summary>
        /// 网格块的高度
        /// </summary>
        public int BHeight
        {
            get { return bHeight; }
            set { bHeight = value; }
        }
        private string bMsg;
        /// <summary>
        /// 网格块的描述信息
        /// </summary>
        public string BMsg
        {
            get { return bMsg; }
            set { bMsg = value; }
        }
        private int bValue;
        /// <summary>
        /// 网格块的键值
        /// </summary>
        public int BValue
        {
            get { return bValue; }
            set { bValue = value; }
        }
        #endregion
    }
}
